﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TVNDBLayer;
using TVNDBLayer.BLL;

public partial class detail : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ((MainMasterPage)Page.Master).SiteWrap = "site-wrap2";
        ((MainMasterPage)Page.Master).IsShowFooter = true;
        if (!IsPostBack)
        {
            if (Request.QueryString["album_id"] != null) ;
            {
                int albumID;
                if (!int.TryParse(Request.QueryString["album_id"].Trim(), out albumID))
                {
                    albumID = 0;
                }

                AlbumBLL albumBLL = new AlbumBLL();
                ArticleBLL articleBLL = new ArticleBLL();
                Album al = albumBLL.GetAlbumByID(albumID);
                if (al != null)
                {


                    ltlTitle.Text = al.AlbumTitle;
                    ltlCreateDate.Text = al.CreateDate.Value.ToString("dd/MM/yyyy");
                    ltlDescription.Text = al.AlbumDescription;
                    ltlUserName.Text = al.User.UserName;

                    var data = articleBLL.GetPhotosByAlbumID(albumID);
                    if (data!=null)
                    {
                        rptPhoto.DataSource = data;
                        rptPhoto.DataBind();
                    }

                    
                }
                else
                { 

                }

            }
        }
    }
}